﻿/// <summary>
/// Developer: CHOOI KAH WAI
/// Last Modified: 21/11/2009
/// </summary>

using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.IO;
using System.Diagnostics;

namespace ARSS.Editor
{
	/// <summary>
	/// Interaction logic for NewChildNodeWindow.xaml
	/// </summary>
	public partial class NewChildNodeWindow : Window
    {
        #region Functions

        /// <summary>
        /// Constructor
        /// </summary>
        public NewChildNodeWindow()
		{
			this.InitializeComponent();
			
			// Insert code required on object creation below this point.
		}

        /// <summary>
        /// Apply button clicked
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
		private void ApplyButton_Click(object sender, System.Windows.RoutedEventArgs e)
		{
            this.DialogResult = true;
		}

        /// <summary>
        /// Browse button clicked
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
		private void BrowseButton_Click(object sender, System.Windows.RoutedEventArgs e)
		{
            Microsoft.Win32.OpenFileDialog dialog = new Microsoft.Win32.OpenFileDialog();
            dialog.Filter = "Xaml documents |*.xaml";

            Nullable<bool> result = dialog.ShowDialog();

            if (result == true)
            {
                string filePath = dialog.FileName.Substring(
                    System.IO.Path.GetDirectoryName(
                        Process.GetCurrentProcess().MainModule.FileName).Length + 1);

                ModelFileTextBox.Text = filePath.Replace('\\', '/');
            }
        }

        #endregion
    }
}